import Vue from 'vue'
import App from './App'

import home from './pages/home/home.vue'
Vue.component('home', home)

import call from './pages/call/call.vue'
Vue.component('call', call)

import my from './pages/my/my.vue'
Vue.component('my', my)

import cuCustom from './colorui/components/cu-custom.vue'
Vue.component('cu-custom', cuCustom)

import initPrompt from './common/initPrompt'
initPrompt(Vue)
import Message from './components/message/message.vue'
Vue.component('message', Message)

Vue.filter('strFormat', function (data) {
	return data == null || data == '' ? "" : data
})

Vue.config.productionTip = false

import {
	getDicts,
	selectDictLabel
} from "./common/dict.js"

Vue.prototype.getDicts = getDicts
Vue.prototype.selectDictLabel = selectDictLabel

import message from './common/js/message.js'
// 安装插件
Vue.use(message)

import * as filters from './common/filter.js'

Object.keys(filters).forEach(key => {
	Vue.filter(key, filters[key])
})

App.mpType = 'app'

Date.prototype.format = function (fmt) {
	var o = {
		"M+": this.getMonth() + 1, //月份 
		"d+": this.getDate(), //日 
		"h+": this.getHours(), //小时 
		"m+": this.getMinutes(), //分 
		"s+": this.getSeconds(), //秒 
		"q+": Math.floor((this.getMonth() + 3) / 3), //季度 
		"S": this.getMilliseconds() //毫秒 
	};
	if (/(y+)/.test(fmt)) {
		fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
	}
	for (var k in o) {
		if (new RegExp("(" + k + ")").test(fmt)) {
			fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k])
				.length)));
		}
	}
	return fmt;
}
import uView from '@/uni_modules/uview-ui'
Vue.use(uView)

const app = new Vue({
	...App
})
app.$mount()